<div class="main_bd">

    <div class="panel panel_overview">
        <div class="panel__hd">
            <h3 class="panel__title">编辑商户信息</h3></div>
        <div class="panel__bd">

            <form class="form" action="/user/update?id={$seller.id}" enctype="multipart/form-data" method="post">

                <div class="form_group">
                    <label style="line-height: 32px;">企业名称</label>
                    <input class="form-control len" readonly value="{$seller.company}" name="company" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">联系电话</label>
                    <input class="form-control len" value="{$seller.telephone}" name="telephone" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">传真</label>
                    <input class="form-control len" value="{$seller.fax}" name="fax" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">联系邮箱</label>
                    <input class="form-control len" value="{$seller.email}" name="email" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">联系地址</label>
                    <input class="form-control len" value="{$seller.address}" name="address" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">所在城市</label>
                    <select name="city_id">
                        {volist name="provienceList" id="area"}
                        <option value="{$area.id}">{$area.name}</option>
                        {/volist}
                    </select>
                </div>

                <div class="form_group">
                    <label style="line-height: 32px;">营业范围</label>
                    <textarea class="form-control" cols="56" rows="6" name="business" >{$seller.business}</textarea><small class="padding4-c">请严格按照营业执照上填写，否则不予通过</small>
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;">搜索关键词</label>
                    <input class="form-control len" value="{$seller.keyword}" name="keyword" ><small class="padding4-c">逗号分隔开</small>
                </div>
                <div class="form-group">
                    <label >logo：</label>
                    <input type="file" accept="image/jpeg,image/jpg,image/png" name="thumb" class="form-control">
                    <div id="pic_box" style="display: inline;">
                        <img class="thumb"  width="100px" src="{$seller.thumb}"/>
                    </div>
                </div>


                <button class="btn margin15-r btn_primary">保存修改</button>
            </form>


        </div>
    </div>
</div>
<script>


    $(function() {
        $("input[name='thumb']").on("change", function () {

            var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
                var tempStr = "<img class='thumb' width='200px' style='max-height:200px'  />",
                    $label = $('#pic_box');
                $label.find('img.thumb').remove()
                $label.append(tempStr);
                $label.find('img.thumb').attr('src', objUrl);

            }
        });

    });

    function getObjectURL(file) {
        var url = null ;
        if (window.createObjectURL!=undefined) { // basic
            url = window.createObjectURL(file) ;
        } else if (window.URL!=undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file) ;
        } else if (window.webkitURL!=undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file) ;
        }
        return url ;
    }



    function getStatus(status) {
        if (status == 3) return '已上架'
        if (status == 0) return '未上架'
        return '状态异常';//万一还有其他的呢
    }

    function taggleSatus(id, status) {
        var action = 'up';

        if (status == 0) {
            action = 'down'
        }
        $.post('/mall/' + action, {id: id}, function (res) {
            if (res.code == 1) {
                layer.msg('切换成功');
                grid.draw();

            }
        })
    }

</script>